package bjx.com.kehu.ui.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import bjx.com.kehu.R;
import bjx.com.kehu.utils.Util;

/**
 * Created by jqc on 2017/11/13.
 */

public class ModifyPersonActivity extends BaseActivity {

    ImageView mIVBack;
    TextView mTVTitle;
    TextView mTVEvent;

    EditText mETTel;

    @Override
    protected void initView(Bundle savedInstanceState) {
        setContentView(R.layout.activity_modifyperson);
        mIVBack = getViewById(R.id.back);
        mTVTitle = getViewById(R.id.title);
        mTVTitle.setText("联系电话");
        mTVEvent = getViewById(R.id.event);
        mTVEvent.setText("保存");
        mTVEvent.setVisibility(View.VISIBLE);

        mETTel = getViewById(R.id.modifyperson_et_tel);
    }

    @Override
    protected void setListener() {
        mIVBack.setOnClickListener(this);
        mTVEvent.setOnClickListener(this);
    }

    @Override
    protected void processLogic(Bundle savedInstanceState) {

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.event: // 保存
                String tel = mETTel.getText().toString().trim();
                if (!Util.isMobileNO(tel)) {
                    showToast("请输入正确号码");
                    return;
                }
                setResult(200, new Intent().putExtra("tel", tel));
                finish();
                break;
            case R.id.back:
                finish();
                break;
            default:break;
        }
    }
}
